<template lang="pug">
  div.table-empty
    s-table(
      ref="table"
      v-loading="loading"
      req-method="get"
      reqUrl="web/materials/record"
      :column="classesColumn"
      :filterProps="{fields: searchConfig}"
    )
      template(slot="date" slot-scope="text, scope")
        span {{text | dateFilter('YYYY/MM/DD hh:mm:ss')}}
      template(slot="action" slot-scope="text, scope")
        el-link(@click="actionHandle(scope, 'info')" type="primary") 详情
    detail(v-if="addVisible" :visible.sync="addVisible" :row="row")
</template>
<script>
import { mapGetters } from 'vuex'
import { column } from './config'
import Detail from './detail'
export default {
  components: {
    Detail
  },
  data () {
    return {
      classesColumn: column,

      loading: false,
      addVisible: false,
      row: []
    }
  },
  computed: {
    ...mapGetters(['curArea']),
    searchConfig () {
      return [
        {
          label: '物资分类',
          key: 'type',
          type: 'select',
          fieldProps: {
            options: [
              {
                id: 1,
                name: '借出记录'
              },
              {
                id: 2,
                name: '归还记录'
              },
              {
                id: 3,
                name: '领用记录'
              }
            ],
            props: { value: 'id', label: 'name' }
          },
          initialValue: 1
        }
      ]
    }
  },
  created () {
  },
  methods: {
    refreshTable (flag = false) {
      this.$refs.table.refresh(flag)
    },
    actionHandle (row, type = 'unbind') {
      if (type === 'info') {
        console.log(row)
        this.row = row.items
        this.addVisible = true
      }
    }
  }
}
</script>
<style lang="scss" scoped>
.video{
  width: 100%;
  height: 560px
}
.close{
  margin-top: 20px;
}
</style>
